<?php
defined('SYSTEM_PATH') or die('Han che truy cap');

class Loader extends Object
{

    protected function load($path,$exitOnError = TRUE)
    {
        if(!file_exists($path))
        {
            if($exitOnError)
                exit("File at $path does not exist !");
            else
                return FALSE;
        }
        require_once $path;
        return TRUE;
    }

    protected function loadClass($className,$classPath,$exitOnError = TRUE)
    {
        if(!$this->load($classPath,$exitOnError))
            return FALSE;
        if(!class_exists($className))
        {
            if($exitOnError)
                exit("Class $className does not exist!");
            else
                return FALSE;
        }
        return TRUE;
    }
}

?>
